/**
 * @file CWidget.cpp
 * @author SoBigDog (623644973lubin@163.com)
 * @brief 
 * @version 0.1
 * @date 2020-04-10
 * 
 * @copyright Copyright (c) 2020
 * 
 */
#include "Widget.h"

Widget::Widget(WINDOW * parent, int len_y, int len_x, int y, int x) : m_display(true), m_box(false)
{
	win = subwin(parent, len_y, len_x, y, x);
	wrefresh(win);
	m_cursor = false;
	
}

int Widget::fresh(void)
{
	if (m_display) {
		if (m_box) 
			box(win, 0, 0);

		return wrefresh(win);
	} else {
		return 0;
	}
}

bool Widget::display(bool newstate)
{
	if (newstate) {
		wrefresh(win);
		m_display = true;
		return true;
	} else {
		m_display = false;
		return true;
	}
}

int Widget::resize(int y, int x)
{
	wclear(win);
	return wresize(win, y, x);
	
}

